<?php
/**
 * Created by PhpStorm.
 * Time: 上午12:20
 */
class m_file extends CI_Model
{


    function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    function insert($arr){

        $this->db->insert('file',$arr);
        return true;
    }
    function find_user($options = array(),$count=20, $offset)
    {
        if(!is_array($options))
        {
            //echo '没有设置查询规则books_model line 229';
            return array();
        }
        if ($count)
        {
            //$this->db->limit((int)$count, (int)$offset);
            $limit = "limit $offset , $count";
        }

        $sql = "select * from user ".$limit;
        //echo $sql;
        $query = $this->db->query($sql);
        //$rows = $query->row_array();
        // print_r($rows);
        $temp = $query->result_array();
        //print_r($temp);


        return $temp;
    }
    function find_user_count($options = array())
    {
        if(!is_array($options))
        {
            //echo '没有设置查询规则books_model line 229';
            return array();
        }

        //没有图书类型，只有查询方式和相应关键字

        //查询方式不为空且关键字不为空

        $sql = "select * from user ";

        $query = $this->db->query($sql);
        return $query;
    }
    function getDataCount($options = array(),$user_status=1){
        $query = $this->find_user_count($options,$user_status);
        $total = $query->num_rows();
        return $total;
    }

}

